<template>
  <div class="survey-box">
    <el-row type="flex" justify="space-between" align="middle" class="survey-hedaer">
      <div class="title">运营概括</div>
      <el-link v-if="linkUrl != ''" :underline="false" type="primary" @click="$router.push({ path: linkUrl })">查看详情</el-link>
      <card-header v-else title="" @change="changeOrderTime" />
    </el-row>
    <el-row class="survey-body" :gutter="40">
      <el-col :span="10">
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="operate-card">
              <div class="operate-card-header pink" />
              <div class="operate-contnet">
                <div class="title">销售额({{ site.money_title }})</div>
                <div class="num"><count-roll :number="response.sale_price" :is-money="true" /></div>
                <div class="ratio">日环比: {{ response.sale_price_ratio || 0 | floatSymbol | preSymbol }}</div>
                <div class="ratio">周同比: {{ response.sale_price_week_ratio || 0 | floatSymbol | preSymbol }}</div>
              </div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="operate-card">
              <div class="operate-card-header orange" />
              <div class="operate-contnet">
                <div class="title">付费用户数</div>
                <div class="num"><count-roll :number="response.payment_user_count" /></div>
                <div class="ratio">日环比: {{ response.payment_user_count_ratio || 0 | floatSymbol | preSymbol }}</div>
                <div class="ratio">周同比: {{ response.payment_user_count_week_ratio || 0 | floatSymbol | preSymbol }}</div>
              </div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="operate-card">
              <div class="operate-card-header blue" />
              <div class="operate-contnet">
                <div class="title">付费用户占比</div>
                <div class="num">{{ response.payment_user_count_rate || 0 | preSymbol }}</div>
                <div class="ratio">日环比: {{ response.payment_user_count_rate_ratio || 0 | floatSymbol | preSymbol }}</div>
                <div class="ratio">周同比:{{ response.payment_user_count_rate_week_ratio || 0 | floatSymbol | preSymbol }}</div>
              </div>
            </div>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="14">
        <el-row :gutter="20">
          <el-col :span="12"><sale /></el-col>
          <el-col :span="12"><payment-user-count /></el-col>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Sale from './components/sale.vue';
import CardHeader from '@/pages/vcharts/card/card_header.vue';
import PaymentUserCount from './components/payment_user.vue';
import CountRoll from '@/pages/data/components/count_roll';
import 'v-charts/lib/style.css';
export default {
  components: {
    Sale,
    CardHeader,
    PaymentUserCount,
    CountRoll
  },
  props: {
    // 指定跳转链接,右侧为查看详情按钮,否则为时间选择
    // 暂未时间按时间选择展示数据
    linkUrl: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      response: {}
    };
  },
  created() {
    this.$http.get(
      '/admin/data/survey/operate',
      {},
      response => {
        this.response = response.data;
      },
      errror => {},
      false
    );
  },

  methods: {
    changeOrderTime: function(time) {}
  }
};
</script>

<style lang="scss" scoped>
.survey-box {
  background-color: #fff;
  min-height: 150px;
  margin-bottom: 20px;
  padding: 10px 20px 25px;
  .survey-hedaer {
    margin-bottom: 28px;
    height: 36px;
    padding-right: 20px;
    background-color: #f1f8ff;
    .title {
      color: #303133;
      font-size: 15px;
      padding-left: 6px;
      border-left: 2px solid #5191ff;
    }
  }
  .survey-body {
    margin-top: -32px;
  }
}
.operate-card {
  width: 100%;
  height: 240px;
  border: 1px solid #dcdfe6;
  margin-top: 50px;
  .operate-card-header {
    height: 6px;
    margin: -1px -1px 0;
  }
  .pink {
    background-color: #ff9595;
  }
  .orange {
    background-color: #ffb562;
  }
  .blue {
    background-color: #7bb4ff;
  }
  .operate-contnet {
    text-align: center;
    padding-top: 50px;
    .title {
      color: #606266;
      font-size: 16px;
      margin-bottom: 10px;
    }
    .num {
      font-size: 26px;
      font-weight: bold;
      color: #303133;
      margin-bottom: 40px;
    }
    .ratio {
      color: #606266;
      font-size: 12px;
      & + .ratio {
        margin-top: 15px;
      }
    }
  }
}
</style>
